package com.bw.merchant.view

import android.os.Bundle
import com.alibaba.android.arouter.facade.annotation.Autowired
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter
import com.bw.base.constants.RoutePath
import com.bw.common.adapter.BannerResAdapter
import com.bw.common.adapter.BannerUrlAdapter
import com.bw.common.entity.TabEntity
import com.bw.common.view.BaseMvvmActivity
import com.bw.merchant.databinding.ActivityMerchantDetailBinding
import com.bw.merchant.entity.ProfileEntity
import com.bw.merchant.net.MerchantViewModel

/**
 * 智慧园区-04-商家推荐V1.1
 * 企业详情
 * 兰宏宇
 * 20250508
 */
@Route(path = RoutePath.PATH_MERCHANT_DETAIL)
class MerchantDetailActivity :
    BaseMvvmActivity<ActivityMerchantDetailBinding, MerchantViewModel>() {

    @Autowired
    lateinit var profile: ProfileEntity


    private lateinit var bannerAdapter: BannerUrlAdapter

    override fun initView() {

        binding.tvName.text = profile.name
        binding.tvState.text = profile.status
        binding.tvTel.text = profile.contactInfo
        binding.tvStock.text = profile.stockName
        binding.tvStockCode.text = profile.stockCode
        binding.tvPeople.text = profile.legalRepresentative
        binding.tvIsTop.text = if (profile.listed) "已上市" else "未上市"
        binding.ivBack.setOnClickListener { finish() }


        bannerAdapter = BannerUrlAdapter(profile.photos.map { TabEntity(selImgStr = it) })
        binding.bannerPhone.setAdapter(bannerAdapter)
        binding.bannerPhone.addBannerLifecycleObserver(this)

    }

    override fun initData() {
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        ARouter.getInstance().inject(this)
        super.onCreate(savedInstanceState)
    }

}